// ClientDlg.h : header file
//

#pragma once
#include "clientsocket.h"
#include "afxcmn.h"
#include "Defines.h"


// CClientDlg dialog
class CClientDlg : public CDialog
{
// Construction
public:
	CClientDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_CLIENT_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	static const int MAX_CLIENT = 8;
	ClientSocket m_socket;
	int m_port;
	CString m_ipAddress;
	afx_msg void OnBnClickedExit();
	bool OnSend(void);
	int OnReceive(char* buff, int size);
	afx_msg void OnBnClickedBtnConect();
	afx_msg void OnBnClickedBtnStop();
	afx_msg void OnBnClickedBtnSend();
	CListCtrl m_clientList;
	int AddClientListItem(int clientID);
	int m_clientOnlineArr[MAX_CLIENT];
	char m_szBuff[BUFF_SIZE];
	int SendToClient(int clientID);
	afx_msg void OnBnClickedBtnSendFile();
	bool isDownloading;
	Package m_package;

	byte* fBuff;
	int fSize;
	char fName[256];
	FILE* m_file;
	int m_fSeek;
};
